package app.netant.book.heiyan;

import cn.lily.com.enviroment.Enviroment;
import app.netant.book.base.BaseDetail;
import app.netant.book.base.BaseEntity;
import app.netant.book.base.BasePage;
import app.netant.book.base.BaseRoot;

public class HeiyanRoot extends BaseRoot {
	
	public HeiyanRoot(){
		this.homeUrl = "http://www.heiyan.org/xianxia/";
		this.pageUrl = "http://www.heiyan.org/xianxia/";
		this.tableKey = "heiyan";
	}

	@Override
	public String buildUrl(int pageIdx) {
		if(pageIdx == 1){
			return "http://www.heiyan.org/xuanhuan/";
		}
		else if(pageIdx == 2){
			return "http://www.heiyan.org/xianxia/";
		}
		else if(pageIdx == 3){
			return "http://www.heiyan.org/yanqing/";
		}
		else if(pageIdx == 4){
			return "http://www.heiyan.org/chuanyue/";
		}
		else if(pageIdx == 5){
			return "http://www.heiyan.org/kehuan/";
		}
		else if(pageIdx == 6){
			return "http://www.heiyan.org/wuxia/";
		}
		else if(pageIdx == 7){
			return "http://www.heiyan.org/junshi/";
		}
		else if(pageIdx == 8){
			return "http://www.heiyan.org/kongbu/";
		}
		else if(pageIdx == 9){
			return "http://www.heiyan.org/tongrenxiaoshuo/";
		}
		
		return this.pageUrl;
	}

	@Override
	public BasePage buildPage(String url) {
		return new HeiyanPage(url);
	}

	@Override
	public BaseDetail buildDetail(String url) {
		return new HeiyanDetail(url);
	}

	@Override
	public BaseEntity buildEntity() {
		return new HeiyanEntity();
	}
	
	@Override
	public void afterEntity(BaseEntity entity) {
		
	}
	
	public static void main(String[] args) {
		
		Enviroment.createEnv();
		Enviroment.getEnv().getLogBean().beginLog();
		
		HeiyanRoot root = new HeiyanRoot();
		//root.analyse(9);
		root.excepCycle();
	}


	
}
